home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n15.arc / STRINGS.DOC < prev    next >
Text File  |  1991-08-09  |  4KB  |  83 lines

  1. «MDRV»«MDNM»STRINGS
  2.  
  3.  
  4. Douglas Boling                                  September 10, 1991 (Utilities)
  5.  
  6.         To enable batch files to manipulate strings, request and interpret 
  7. user input, process files, return system information, and perform simple math 
  8. by adding functions to the batch file language.  Stores information in either 
  9. the local or the master environment.
  10.  
  11. Format:  STRINGS [/?][/M][/Pc][environment var =] FUNCTION
  12.      [str1][, str2][, str3]
  13.  
  14. Remarks:  Entered with the /? switch, STRINGS presents a multi-screen help 
  15. list of its FUNCTION calls and their user-supplied parameters (str1, str2, 
  16. str3), which is printed overside.  By default, STRINGS uses the local 
  17. environment (as do batch files) to store user-named environment variables; the 
  18. /M switch places these in the master environment, where they can be accessed 
  19. by multiple DOS sessions under Windows.  The /M switch is also useful for 
  20. preserving variable assignments made when shelled out from an application, for 
  21. the default local environment is lost when you exit from DOS back into the 
  22. running program.  
  23.  
  24.         The parse character, used to separate parameter strings, can be 
  25. changed from the default comma to any unused character c, by specifying the 
  26. /Pc switch.  Leading spaces before a parameter string are normally ignored; 
  27. they can be preserved by doubling the parse character (which is not printed) 
  28. immediately before the beginning of the parameter.
  29.  
  30.         To illustrate the syntax, using one of the functions listed overside, 
  31. if executed from within a .BAT file, the command
  32.  
  33.         STRINGS /M XYZ = MID This is a sample string, 11, 6
  34.  
  35.         would store the word sample (which starts with the 11th character in 
  36. the parameter string and itself occupies 6 characters) under the variable name 
  37. XYZ in the master environment.  STRINGS could later be used to retrieve this 
  38. value by using the MASTERENV function and specifying XYZ as its parameter.  
  39.  
  40.         A null string is returned if 0 characters are specified when using the 
  41. LEFT or RIGHT functions, or if a starting character larger than the string 
  42. length is requested when using the MID function.  Assigning a null string to a 
  43. variable erases that variable name from the environment.
  44.  
  45.         ERRORLEVEL 1 codes are returned by attempting to READ line 0 or a line 
  46. number greater than contained in the specified file, and by attempting to 
  47. WRITE (append a line to) a read-only file.  The SUB (subtract) function also 
  48. returns an ERRORLEVEL 1 code when the result is a negative number; this can be 
  49. used by a batch file to implement a compare function.
  50.  
  51.         The table below lists the functions supported by STRINGS, together 
  52. with the parameters to be supplied.  A fuller account of each of these is 
  53. printed in the original article.
  54.  
  55. Function  Description                   Parameters to Supply
  56.  
  57. LEFT      Returns left n chars          String, No. chars
  58. RIGHT     Returns right n chars         String, No. chars
  59. MID       Returns middle n chars        String, Start char, Len.
  60. LENGTH    Returns string length         String
  61. FIND      Finds position of findstring  String, findstring
  62. FINDC     Case sensitive FIND           String, findstring
  63. LOWER     Returns string all lowercase  String
  64. UPPER     Returns string all uppercase  String
  65. CHAR      Returns ASCII no. of char     Character
  66. VAL       Returns ASCII char of no.     Number
  67. READ      Returns a line from a file    Filename, line number
  68. WRITE     Writes string to end of file  Filename, String
  69. FILESIZE  Returns file size             Filename
  70. LINESIZE  Returns no. of lines          Filename
  71. FILENAME  Returns filename              Filespec
  72. FILEEXT   Returns file extension        Filespec
  73. TRUENAME  Returns qualified filename    Filename
  74. ASK       Returns user response         [Prompt string]
  75. ADD       Returns the sum of two nos.   Number, Number
  76. SUB       Returns difference of two nos.Number, Number
  77. MUL       Returns product of two nos.   Number, Number
  78. DIV       Returns quotient of two nos.  Number, Number
  79. VER       Returns the DOS version no.
  80. ENVFREE   Returns the bytes free in the environment
  81. ENVSIZE   Returns the size of the environment
  82. MASTERVAR Returns a variable from the Master env.
  83.